import { HurtType, MonsterType, TeamID } from "js/typeDefine/typeDefine"


export class TeamSkillModel {
    cd: number
    triggerTime: number
    skill: SkillModel
    teamAttack: number
    constructor (opts: any ={}) {
        this.cd = opts.cd || 0
        this.triggerTime = opts.triggerTime || 0
        this.skill = opts.skill || new SkillModel({})
        this.teamAttack = opts.teamAttack || 0
    }
}


export class SkillModel {
    skillID: number
    skillLvl: number
    auxiliarySkills: [number, number][]//辅助技能
    cd : number
    cdPer: number
    addBuff: number
    addDeBuff: number
    hurtPer: number
    bossHurtPer: number
    reduceAnger: number
    reduceDef: number
    reduceAllDef: number
    killMonsterPer: number
    highLevel: boolean //武功优先攻击高级敌人
    hpHurtPer: [number, number]
    angerHurtPer: number
    doubleTriggerPer: number
    cdAddHurt1: number
    cdAddHurt2: number
    triggerLimitTimes: number
    triggerTimes: number
    firstCd: number
    constructor(opts: any = {}) {
        this.skillID = opts.skillID || 0
        this.skillLvl = opts.skillLvl || 0
        this.auxiliarySkills = opts.auxiliarySkills || []
        this.cd = opts.cd || 1000
        this.cdPer = opts.cdPer || 0
        this.addBuff = opts.addBuff || 0
        this.addDeBuff = opts.addDeBuff || 0
        this.hurtPer = opts.hurtPer || 0
        this.bossHurtPer = opts.bossHurtPer || 0
        this.reduceDef = opts.reduceDef || 0
        this.reduceAllDef = opts.reduceAllDef || 0
        this.killMonsterPer = opts.killMonsterPer || 0
        this.highLevel = opts.highLevel || false
        this.hpHurtPer = opts.hpHurtPer || null
        this.reduceAnger = opts.reduceAnger || 0
        this.doubleTriggerPer = opts.doubleTriggerPer || 0
        this.angerHurtPer = opts.angerHurtPer || 0
        this.cdAddHurt1 = opts.cdAddHurt1 || 0
        this.cdAddHurt2 = opts.cdAddHurt2 || 0
        this.triggerTimes = opts.triggerTimes || 0
        this.triggerLimitTimes = opts.triggerLimitTimes || 0
        this.firstCd = opts.firstCd || 0

    }
}

export class BuffModel {
    buffID: number
    lvl: number
    stack: number
    deliverIndex: number //释放者
    timerID: number
    triggerTimerID: number
    constructor(opts: any = {}) {
        opts = opts || {}
        this.buffID = opts.buffID || 0
        this.lvl = opts.lvl || 0
        this.stack = opts.stack || 0
        this.deliverIndex = opts.deliverIndex || 0
        this.timerID = opts.timerID || 0
        this.triggerTimerID = opts.triggerTimerID || 0
    }
}

export class EffectModel {
    skillID: number
    skillLvl: number
    type: any
    data: any
    constructor(opts: any = {}) {
        this.skillID = opts.skillID || 0
        this.skillLvl = opts.skillLvl || 0
        this.data = opts.data || null
        this.type = opts.type || 0
    }
}

interface EffectInterface {
    [id: number]: EffectModel[]
}

export class FighterSpecialAttriModel {
   
    cd: number
    critHurtPer: number
    critPer: number
    constructor(opts: any = {}) {

    }
}

export class FighterAttriModel {
  
    hp: number
    hurtType: HurtType
    //一级属性
    maxHp: number
    attack: number
    def: number //护甲
    puncture: number //穿透
    lDef: number//电伤防御
    sDef: number//毒伤防御
    fDef: number//火伤防御
    allDef:number//全抗
    attackSpeed: number//攻速
    hit: number //命中
    dodge: number //闪避
    crit: number //暴击
    antiCrit: number //暴击抵抗
    recoverHp: number//生命恢复

    shield: number//护盾buff

    //一级属性百分比提升
    maxHpPer: number
    attackPer: number
    defPer: number
    puncturePer: number
    lDefPer: number//电伤防御
    sDefPer: number//毒伤防御
    fDefPer: number//火伤防御
    attackSpeedPer: number//攻速
    attackLimit: boolean
    hitPer: number //命中
    dodgePer: number //闪避
    critPer: number //暴击
    antiCritPer: number //暴击抵抗
    recoverHpPer: number//生命恢复%

    critHurtPer: number //暴击伤害%

    critHurt: number //暴击伤害
    antiCritHurt: number //暴伤抗性

    bloodHp: number//数值 吸血
    bloodHpPer: number//百分比 吸血
    reduceDefPer: number //减低护甲
    reduceLHurt: number//法伤减免
    reduceSHurt: number//毒伤减免
    reduceFHurt: number//火伤减免
    reduceSkillHurt: number//技能伤害减免
    reduceHurt: number//减伤
    injured: number //易伤
    // pHurt: number//物伤加成
    lHurt: number//电伤加成
    sHurt: number//毒伤加成
    fHurt: number//火伤加成
    skillHurt: number //技能伤害加成

    reduceRecover: number //禁疗
    antiReduceRecover: number //禁疗抗性
    fanTan: number //反伤系数
    antiFanTan: number //反伤抗性
    hitRange: number//攻击数量
    reduceSkillCd: number//出招 每点降低50毫秒CD
    addAnger: number
    angerMax: number

    addSkillHurt: number
    realHurt: number
    antiRealHurt: number
    reduceAttackHurt: number
    addAttackHurt: number
    constructor(opts: any = {}) {
        this.hurtType = opts.hurtType || HurtType.Normal
        this.hp = opts.hp || 0
        this.addSkillHurt = opts.addSkillHurt || 0
        this.realHurt = opts.realHurt || 0
        this.antiRealHurt = opts.antiRealHurt || 0
        this.reduceAttackHurt = opts.reduceAttackHurt || 0
        this.maxHp = opts.maxHp || 0
        this.attack = opts.attack || 0
        this.def = opts.def || 0
        this.puncture = opts.puncture || 0
        this.lDef = opts.lDef || 0
        this.sDef = opts.sDef || 0
        this.fDef = opts.fDef || 0
        this.allDef = opts.allDef || 0
        this.attackSpeed = opts.attackSpeed || 0
        this.hit = opts.hit || 0
        this.dodge = opts.dodge || 0
        this.crit = opts.crit || 0
        this.antiCrit = opts.antiCrit || 0

        this.shield = opts.shield || 0

        this.maxHpPer = opts.maxHpPer || 0
        this.attackPer = opts.attackPer || 0
        this.defPer = opts.defPer || 0
        this.puncturePer = opts.puncturePer || 0
        this.lDefPer = opts.lDefPer || 0
        this.sDefPer = opts.sDefPer || 0
        this.fDefPer = opts.fDefPer || 0
        this.attackSpeedPer = opts.attackSpeedPer || 0
        this.hitPer = opts.hitPer || 0
        this.dodgePer = opts.dodgePer || 0
        this.critPer = opts.critPer || 0
        this.antiCritPer = opts.antiCritPer || 0
        this.recoverHpPer = opts.recoverHpPer || 0
        this.critHurtPer = opts.critHurtPer || 0

        this.critHurt = opts.critHurt || 0
        this.antiCritHurt = opts.antiCritHurt || 0

        this.recoverHp = opts.recoverHp || 0
        this.bloodHp = opts.bloodHp || 0
        this.bloodHpPer = opts.bloodHpPer || 0
        this.reduceDefPer = opts.reduceDefPer || 0
        this.reduceLHurt = opts.reduceLHurt || 0
        this.reduceSHurt = opts.reduceSHurt || 0
        this.reduceFHurt = opts.reduceFHurt || 0
        this.reduceSkillHurt = opts.reduceSkillHurt || 0
        this.reduceHurt = opts.reduceHurt || 0
        this.injured = opts.injured || 0
        this.lHurt = opts.lHurt || 0
        this.sHurt = opts.sHurt || 0
        this.fHurt = opts.fHurt || 0
        this.skillHurt = opts.skillHurt || 0

        this.reduceRecover = opts.reduceRecover || 0
        this.antiReduceRecover = opts.anitReduceRecover || 0
        this.fanTan = opts.fanTan || 0
        this.antiFanTan = opts.anitFanTan || 0
        this.hitRange = opts.hitRange || 0
        this.reduceSkillCd = opts.reduceSkillCd || 0
        this.addAnger = opts.addAnger || 0
        this.angerMax = opts.angerMax || 0
        this.attackLimit = opts.attackLimit || true
        this.addAttackHurt = opts.addAttackHurt || 0
    }
}

export class PetFighterAttriModel {
    quality: number
    elements: number[]
    constructor(opts: any = {}) {
        this.quality = opts.quality || 0
        this.elements = opts.elements || []
    }
}

export class FighterModel {
    tID: number
    lvl: number
    type: MonsterType
    battlePos: number
    battleY: number
    teamID: TeamID
    indexID: any
    attri: FighterAttriModel//角色战斗属性
    battleAttri: FighterAttriModel//角色战斗中的战斗属性   把buff等其他因素考虑进去后的战斗属性
    timers: number[]
    timerObject: any
    skills: SkillModel[]
    waitSkills: SkillModel[]
    wuXingId: number
    effects: EffectInterface
    buffs: BuffModel[]
    status: any //状态
    skillsHurtPer: any = {}
    skillsReduceCd: any = {}
    statusHurtPer: any = {}
    statusReduceHurt: any = {}
    anger: number
    petFighterAttri: PetFighterAttriModel
    power: number
    quality: number
    attriRate: any
    formationPos: number
    skillTrigger: any
    attriPoint: any
    hatredType: number
    constructor(opts: any = {}) {
        this.tID = opts.tID || 0
        this.lvl = opts.lvl || 1
        this.type = opts.type || MonsterType.Partner
        this.indexID = opts.indexID || 0
        this.teamID = opts.teamID || TeamID.Team1
        this.attri = opts.attri || null
        this.battleAttri = opts.battleAttri || null
        this.timers = opts.timers || []
        this.skills = opts.skills || []
        this.waitSkills = opts.waitSkills || []
        this.buffs = opts.buffs || []
        this.effects = opts.effects || {}
        this.wuXingId = opts.wuXingId || 0
        this.timerObject = opts.timerObject || {}
        this.status = opts.status || {} 
        this.skillsHurtPer = opts.skillsHurtPer || {}
        this.skillsReduceCd = opts.skillsReduceCd || {}
        this.statusHurtPer = opts.statusHurtPer || {}
        this.statusReduceHurt = opts.statusReduceHurt || {}
        this.anger = opts.anger || 0
        this.petFighterAttri = opts.petFighterAttri || null
        this.power = opts.power || 0
        this.battleY = opts.battleY || 0
        this.quality = opts.quality || 0
        this.attriRate = opts.attriRate || {}
        this.formationPos = opts.formationPos || null
        this.skillTrigger = opts.skillTrigger || {}
        this.attriPoint = opts.attriPoint || {}
        this.hatredType = opts.hatredType || 1
    }
}